module GiteeTransfer
  class Language
    class << self
      def languages
        @languages ||= Request.new.get_languages
      end

      def get_language_id(name)
        language_id = 0
        return language_id if name.nil? || name.empty?

        languages.each do |language|
          if language['name'] == name
            language_id = language['id']
            break
          end
        end

        language_id
      end
    end
  end
end
